import java.util.Scanner;

import static java.lang.System.exit;

public class Main {

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {
		System.out.print("输入数组长度n：");
		int n = scanner.nextInt();
		int[] a = new int[n];
		System.out.print("输入n个数组元素：");
		for (int i = 0; i < n; i++) {
			a[i] = scanner.nextInt();
		}
		System.out.println("请输入你要选择的排序方法：");
		System.out.println("1 -- 选择排序");
		System.out.println("2 -- 冒泡排序");
		System.out.println("3 -- 插入排序");
		int op = scanner.nextInt();
		if (op == 1) {
			ArraySorter.selectionSort(a);
		} else if (op == 2) {
			ArraySorter.bubbleSort(a);
		} else if (op == 3) {
			ArraySorter.InsertSort(a);
		} else {
			System.out.println("输入有误");
			exit(0);
		}
		System.out.print("排序后的数组：");
		for (int i = 0; i < n; i++) {
			System.out.printf("%d ", a[i]);
		}
	}
}
